package com.sun.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.common.MsResult;
import com.sun.pojo.PmsProductAttribute;
import com.sun.pojo.PmsProductAttributeCategory;
import com.sun.service.IPmsProductAttributeCategoryService;
import com.sun.service.IPmsProductAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 商品属性参数表 前端控制器
 * </p>
 *
 * @author 妙妙屋
 * @since 2021-12-27
 */
@RestController
@RequestMapping("/productAttribute/category")
public class PmsProductAttributeCategoryController {

    @Autowired
    private IPmsProductAttributeCategoryService pmsProductAttributeCategoryService;

    @Autowired
    private IPmsProductAttributeService pmsProductAttributeService;
    @GetMapping("/list")
    public MsResult list(Long pageSize,Long pageNum){
        Page<PmsProductAttributeCategory> p = new Page<>(pageNum, pageSize);
        Page page = pmsProductAttributeCategoryService.page(p, null);
        return MsResult.isOkDataPage(page);
    }

    @GetMapping("/list/withAttr")
    public MsResult cateListWithAttr(){
        List<PmsProductAttributeCategory> pmsProductAttributeCategoryList = pmsProductAttributeService.cateListWithAttr();
        return MsResult.isOkData(pmsProductAttributeCategoryList);
    }



}



